<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>揉捏DIV</title>
    <style>
        .comment {
            font-size: 16px;
        }
        #btn_setting {
            background-color: #0d6aad;
            color: darkorange;
            text-align: center;
            font-size: 12px;
            width: 80px;
            height: 30px;
        }
        #box {
            width: 120px;
            height: 120px;
            background-color: #fff;
            border: 5px solid black;
            border-collapse: collapse;
            border-radius: 10px;
            /*圆角*/
        }
        .mask {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }
        .select {
            /*padding: 50% 50% 50% 50%;*/
            background-color: deepskyblue;
            width: 450px;
            height: 300px;
            position: center;
            margin-left: 620px;
            margin-top: 160px;
            border-radius: 10px;
            border: 15px solid #cde;
        }
        .mask ul{
            list-style: none;
            line-height: 55px;
        }

        .mask span{
            font-family: '幼圆';
            font-size: 21px;
            font-weight: bold;
            border: 2px solid black;
            padding: 1px 4px 1px 4px;
        }
        .mask li{
            font-family: '幼圆';
            font-size: 22px;
            font-weight: bold;
        }
        .mask .red {
            background-color: red;
        }
        .mask .purple {
            background-color: purple;
        }
        .mask .pink {
            background-color: pink;
        }
        .mask .wrap_buttons {
            margin-left: 156px;
            margin-top: 30px;
        }
        .wrap_buttons span {
            font-size: 26px;
            font-family: 微软雅黑;
        }
        .wrap_button_recover {
            background-color: #eea236;
        }
        .wrap_button_confer {
            background-color: #00d6b2;
        }
    </style>
</head>
<body>
<div id="header">
    <strong class="comment">请修改以下方块属性：</strong> <button id="btn_setting">点击设置</button>
    <br>
    <br>
    <div id="box"></div>

    <div id=mask class="mask">
        <div class="select">
            <ul>
                <li>设置颜色：<span class="red">红色</span>&nbsp;&nbsp;<span class="pink">粉红</span>&nbsp;&nbsp;<span class="purple">紫色</span></li>
                <li>设置宽度：<span id="w_200">200px</span>&nbsp;<span id="w_400">400px</span>&nbsp;<span id="w_600">600px</span></li>
                <li>设置高度：<span id="h_200">200px</span>&nbsp;<span id="h_400">400px</span>&nbsp;<span id="h_600">600px</span></li>
            </ul>
            <div class="wrap_buttons">
                <span class="wrap_button_recover">恢复</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="wrap_button_confer">确认</span></div>
        </div>
    </div>
</div>
<script>
    var box=document.querySelector('#box');
    var mask = document.getElementById('mask');
    var btn_setting = document.getElementById('btn_setting');
    var red = document.querySelector('.red');
    var purple = document.querySelector('.purple');
    var pink = document.querySelector('.pink');
    var w_200 = document.getElementById('w_200');
    var w_400 = document.getElementById('w_400');
    var w_600 = document.getElementById('w_600');
    var h_200 = document.getElementById('h_200');
    var h_400 = document.getElementById('h_400');
    var h_600 = document.getElementById('h_600');
    var wrap_button_confer=document.querySelector('.wrap_button_confer');
    var wrap_button_recover=document.querySelector('.wrap_button_recover');
    btn_setting.onclick=function () {
        var mask_display=mask.style.display;
        console.log(mask_display);
        if(mask_display=='none'){
            mask.style.display='inline';
        }else{
            mask.style.display='none';
        }
    };

    red.onclick=function () {
        box.style.backgroundColor='red';
    };
    purple.onclick=function () {
        box.style.backgroundColor='purple';
    };
    pink.onclick=function () {
        box.style.backgroundColor='pink';
    };

    w_200.onclick=function () {
        box.style.width='200px';
    };
    w_400.onclick=function () {
        box.style.width='400px';
    };
    w_600.onclick=function () {
        box.style.width='600px';
    };
    h_200.onclick=function () {
        box.style.height='200px';
    };
    h_400.onclick=function () {
        box.style.height='400px';
    };
    h_600.onclick=function () {
        box.style.height='600px';
    };
    // wrap_button_recover.onclick=function () {
    //     box.style.width='100px';
    //     box.style.height='100px';
    //     box.style.backgroundColor='#fff';
    // };
    wrap_button_recover.onclick = function () {
      box.style.cssText='width: 100px;height: 100px;background-color: #fff;';
    };

    wrap_button_confer.onclick=function () {
        console.log(mask.style.display);
        mask.style.display='none';
    };
</script>
</body>
</html>